﻿using System;

namespace HB.HttpServer
{
    /// <summary>
    /// 【覆盖特性】频率过滤器
    /// </summary>
    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]
    public class HttpFrequency : Attribute
    {
        public enum FilterType
        {
            /// <summary>
            /// 通过IP过滤
            /// </summary>
            ForIp,
            /// <summary>
            /// 全局过滤
            /// </summary>
            ForPublic
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="type"></param>
        /// <param name="feq">频率 feq/秒</param>
        public HttpFrequency(FilterType type, double feq)
        {
            Frequency = feq;
            Filtertype = type;
        }
        internal double Frequency { get; set; }
        internal FilterType Filtertype { get; set; }
    }
}
